AC_INIT([eapmlib],[0.1],[xavierbaro@gmail.com])

# Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

# setup automake - we need >= 1.6 because of python and aclocal support
#                  we updated to 1.9 because of cross-platform issues
AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([1.9])
AC_PROG_MAKE_SET

# checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LIBTOOL
AC_LANG_CPLUSPLUS
AC_PROG_RANLIB
AC_CACHE_SAVE

# Configure the output paths
out_bin_path=bin/
out_lib_path=/lib/
out_tmp_path=_temp/

AC_SUBST(out_bin_path)
AC_SUBST(out_lib_path)
AC_SUBST(out_tmp_path)

# Configure the OpenCV path
OpenCV_INC_PATH=/usr/include/opencv
AC_SUBST(OpenCV_INC_PATH)

# Configure the Matlab path
Matlab_INC_PATH=/usr/share/matlab/extern/include
AC_SUBST(Matlab_INC_PATH)


AC_CACHE_SAVE

# Check for libraries
opencv_libs=
AC_CHECK_LIB([cv],[cvResize],
[
AC_LIBOBJ([cv])
AC_DEFINE([HAVE_CV_H],[1],[OpenCV: cv is available])
])
AC_CHECK_LIB([cvaux],[cvCreateObsInfo],
[
AC_LIBOBJ([cvaux])
AC_DEFINE([HAVE_CVAUX_H],[1],[OpenCV: cvaux is available])
])
AC_CHECK_LIB([cxcore],[cvCreateImage],
[
AC_LIBOBJ([cxcore])
AC_DEFINE([HAVE_CXCORE_H],[1],[OpenCV: cxcore is available])
])
AC_CHECK_LIB([highgui],[cvStartWindowThread],
[
AC_LIBOBJ([highgui])
AC_DEFINE([HAVE_HIGHGUI_H],[1],[OpenCV: highgui is available])
])
AC_CACHE_SAVE

AC_CONFIG_FILES([Makefile \
		 eapmlib/Makefile \
		 apps/testlib/Makefile \
		 apps/ABLearning/Makefile \
		 MatlabMEX/MEXGmmEM/Makefile \
		 MatlabMEX/MEXGetSamplesInfo/Makefile \
		 MatlabMEX/MEXNBE/Makefile])

# Create the output files
AC_OUTPUT
